package day14;
import java.util.*;

/**
 * https://www.nowcoder.com/practice/a5190a7c3ec045ce9273beebdfe029ee?tpId=85&&tqId=29839&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        int count = count(array,n,0,0,1);
        System.out.println(count);
    }

    public static int count(int[] array,int n,int pos,int add,int multi) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            add += array[i];
            multi *= array[i];
            if(add > multi) {
                count = count+1+count(array,n,i+1,add,multi);
            } else if(array[i] == 1) {
                count = count+count(array,n,i+1,add,multi);
            } else {
                break;
            }
            add=add-array[i];
            multi=multi/array[i];
            while(i<n-1 && array[i]==array[i+1]){
                i++;
            }
        }
        return count;
    }
}
